<script language="JavaScript">

function CheckText(object,form) {
var fl=1;
var cnt=0;

t=new String(" ,");
text=new String;
text=object.value;

cnt = text.length-1;


if (object.value == "user" || object.value == "default" || object.value == "Server_" || object.value == "Server" || object.value == "server" || object.value == "_Server" || object.value == "Admin" || object.value == "Administrator" || object.value == "admin" || object.value == "administrator" || object.value == "root") {

  alert("Cant allow word " + object.value);

  object.focus();

  return false;

}


if (text.charAt(cnt) == "0") {
  alert("Cant allow symbol 0 at the end in " + object.value);
  object.focus();
  return false;
}

for (i=0;i<text.length;i++) {

  for(j=0;j<t.length;j++) {

	  if (text.charAt(i) == t.charAt(j)) {
		  fl=0;
	  }

  }

  if (fl==0)
  {
  alert("Cant allow simbol '" + text.charAt(i)+ "' in " + "'" + object.value + "'");
  object.value="";
  object.focus();
  return false;
  }
 fl=1;
 }

return true;
}

function CheckEmail(object,form) {

t=new String("._-1234567890qwertyuiopasdfghjklzxcvbnmQWERTYUIOPASDFGHJKLZXCVBNM@");
text=new String;
text=object.value;
var fl=0;

if (!(/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,4})+$/.test(object.value))) {

	alert("Incorrect e-mail adress entered");
	object.focus();
    return false;
}

for (i=0;i<text.length;i++)
{
  for(j=0;j<t.length;j++)
  {
  if (text.charAt(i)==t.charAt(j))
  {
  fl=1;
  }
  }

  if (fl==0)
  {
  alert("Cant allow simbol " + text.charAt(i)+ " in " + object.value);
  object.focus();
  return false;
  }
 fl=0;
 }

return true;
}

function CheckInfo(form) {

	var ch1;
	var ch2;

	for (i=0;i<form.elements.length;i++) {
	    if (form.elements[i].value=="")
	    {
            if (form.elements[i].id!=1)
        	{
	        alert("All req. fields must be filled!");
	        form.elements[i].focus();
            return;
            }
         }
    }

	ch1 = CheckEmail(form.email,form);
    ch2 = CheckText(form.callsign,form);
    if (ch1 != true || ch2 != true)
	    return;

    form.submit();
    return true;

}

</script>

<table width="100%"  border="0" cellspacing="0" cellpadding="0">
          <tr>
            <td>&nbsp;</td>
          </tr>
          <tr>
            <td><div align="center" class="text4"><?php echo $SLANG[sqpanel][$lang][redacting];?> <?php echo $pilot[callsign]; ?> </div></td>
          </tr>
          <tr>
            <td>&nbsp;</td>
            </tr>
          <tr>
            <td>
            	<table width="100%"  border="0" cellspacing="0" cellpadding="0">
              		<tr>
                		<td width="250" align="left" valign="top">
                			<img src="<!--ImageURL--><?php echo $FLAG;?>" width="200" height="400">
                        </td>
                		<td align="left" valign="top">
			                <table width="450"  border="0" cellpadding="0" cellspacing="0" class="table5">
            			      <tr>
			                    <td width=100% height="20" colspan="3" class="table4">&nbsp;</td>
	        			        <td width="40" rowspan="2"><img src="<!--ImageURL--><?php echo $ICON;?>" width="40" height="40"></td>
			                  </tr>
            			      <tr>
			                    <td height="20" colspan="2" class="back5">&nbsp;</td>
            			      </tr>
							  <tr>
		                    	<td valign=top align=center colspan=2>
        		                	<table border=0 cellpadding=0 cellspacing=0 width=100% valign=top align=center>

	                                    <form name=form2 method=post enctype="multipart/form-data">

	                                    <input type=hidden name=allsqpilots value=1>
	                                    <input type=hidden name=dopilotredact value=1>
	                                    <input type=hidden name=redact_pilot[<?php echo $pilot[pilotid];?>] value=1>
	                                    <?php
	                                        $pilot[callsign] = ereg_replace("^".$VARS[squad][tag],"",$pilot[callsign]);
	                                    ?>
	                                    <tr>
	                                        <td align="center">
	                                            <?php echo $SLANG[sqpanel][$lang][mojnosmenit];?> <?php echo $pilot[callsign_max_count]-$pilot[callsign_count];?> <?php echo $SLANG[sqpanel][$lang][raz];?>
	                                        </td>
	                                        <td width="10" align="center">&nbsp;</td>
	                                        <td align="center">
	                                            <?php echo $SLANG[sqpanel][$lang][mojnosmenit];?> <?php echo $pilot[email_max_count]-$pilot[email_count];?> <?php echo $SLANG[sqpanel][$lang][raz];?>
	                                        </td>
	                                    </tr>
	                                    <tr>
	                                        <td align="center">
	                                            <?php echo $SLANG[$lang][callsign];?>:&nbsp;&nbsp;<input type=text class="form2a" value="<?php echo $VARS[squad][tag];?>" readonly="true"><input name="callsign" type="text" class="form5" value="<?php echo $pilot[callsign];?>">
	                                        </td>
	                                        <td width="10" align="center">&nbsp;</td>
	                                        <td align="center">
	                                            E-mail:&nbsp;&nbsp;<input name="email" type="text" class="form5" value="<?php echo $pilot[email];?>">
	                                        </td>
	                                    </tr>
		                            </table>
		                        </td>
        		            </tr>

			                <tr>
			                    <td height="30">&nbsp;</td>
            		        </tr>

							<tr>
			                    <td height="10">&nbsp;</td>
            		      	</tr>
                  			<tr>
                    			<td height="20" colspan=2>
	                                <div align="center">
	                                <a href="#" onclick="CheckInfo(form2);"><?php echo $SLANG[sqpanel][$lang][redact];?></a></div>
			                    </td>
            			    </tr>
                  			<tr>
                    			<td height="20">&nbsp;</td>
                  			</tr>
                  <tr>
                  	<td align=left>
                    	<table>
                        	<tr>
			                    <td height="20" width=20>&nbsp;</td>
            			        <td height="20" colspan="2"><a href='<!--SiteURL-->adw/index.html'><< <?php echo $SLANG[sqpanel][$lang][back];?></a></td>
                            </tr>
                        </table>
                    </td>
                  </tr>
                </table></td>
              </tr>
            </table></td>
          </tr>
          <tr>
            <td>&nbsp;</td>
            </tr>
        </table>
</form>